package com.game;

import com.game.common.FSMStateId;
import com.game.common.FSMTriggerId;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * no one is coming ,unless you change by yourself
 *
 * @author : pang-yun
 * @date : 2022/2/10
 * @description :  状态类
 */

public abstract class FSMState {

    private FSMStateId stateId;

    //条件列表
    private List<FSMTrigger> triggers;


    //映射表
    private HashMap<FSMTriggerId,FSMStateId> stateMap;

    public FSMState() {
        stateMap = new HashMap<FSMTriggerId,FSMStateId>();
        triggers= new ArrayList<FSMTrigger>();
        init();

    }
    //要求必须初始化状态类，为编号赋值
    public abstract void init();

    public void AddMap(FSMTriggerId fsmTriggerId,FSMStateId fsmStateId){
        //添加映射
        stateMap.put(fsmTriggerId,fsmStateId);
        //创建爱你条件对象
        FSMTrigger fsmTrigger = FSMTriggerId.fSMTriggerIdAndEntity.get(fsmTriggerId);
        triggers.add(fsmTrigger);
    }

    //--------进入状态 、 在状态之中  退出状态

    public void enterState(){};
    public void actionState(){};
    public void exitState(){};


}
